﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using GU.WebERP.Dict;

namespace GU.WebERP.Model
{
    [Serializable]
    public class Model_Dim_Menu : JnsFramework.Common.IModel
    {
        /// <summary>
        /// Description:菜单自增 ID  
        /// </summary>
        public int MenuId
        {
            get;
            set;
        }

        /// <summary>
        /// Description:菜单名  
        /// </summary>
        public string MenuName
        {
            get;
            set;
        }

        /// <summary>
        /// Description:菜单父节点 ID  
        /// </summary>
        public int ParentId
        {
            get;
            set;
        }

        /// <summary>
        /// Description:菜单指向的网页  
        /// </summary>
        public string Link
        {
            get;
            set;
        }

        /// <summary>
        /// Description:备注  
        /// </summary>
        public string Remark
        {
            get;
            set;
        }

        /// <summary>
        /// Description:  
        /// </summary>
        public int Display
        {
            get;
            set;
        }

        /// <summary>
        /// Description:  
        /// </summary>
        public int Sort
        {
            get;
            set;
        }

        /// <summary>
        /// Description:是否已被删除  1：已删除   0 ：未删除  
        /// </summary>
        public int Disabled
        {
            get;
            set;
        }

        /// <summary>
        /// Description:创建时间  
        /// </summary>
        public DateTime Rec_CreateTime
        {
            get;
            set;
        }

        /// <summary>
        /// Description:创建人  
        /// </summary>
        public string Rec_CreateBy
        {
            get;
            set;
        }

        /// <summary>
        /// Description:修改时间  
        /// </summary>
        public DateTime Rec_ModifyTime
        {
            get;
            set;
        }

        /// <summary>
        /// Description:修改人  
        /// </summary>
        public string Rec_ModifyBy
        {
            get;
            set;
        }


        public static Model_Dim_Menu TableToModel(DataTable dtDim_Menu)
        {
            if (dtDim_Menu != null && dtDim_Menu.Rows.Count > 0)
            {
                return TableRowToModel(dtDim_Menu.Rows[0]);
            }
            else
            {
                return null;
            }
        }


        public static Model_Dim_Menu TableRowToModel(DataRow drDim_Menu)
        {
            Model_Dim_Menu mDim_Menu = new Model_Dim_Menu();
            if (drDim_Menu[Dict_Dim_Menu.MenuId] != null && drDim_Menu[Dict_Dim_Menu.MenuId].ToString() != "")
            {
                mDim_Menu.MenuId = Convert.ToInt32(drDim_Menu[Dict_Dim_Menu.MenuId].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.MenuName] != null && drDim_Menu[Dict_Dim_Menu.MenuName].ToString() != "")
            {
                mDim_Menu.MenuName = drDim_Menu[Dict_Dim_Menu.MenuName].ToString();
            }
            if (drDim_Menu[Dict_Dim_Menu.ParentId] != null && drDim_Menu[Dict_Dim_Menu.ParentId].ToString() != "")
            {
                mDim_Menu.ParentId = Convert.ToInt32(drDim_Menu[Dict_Dim_Menu.ParentId].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.Link] != null && drDim_Menu[Dict_Dim_Menu.Link].ToString() != "")
            {
                mDim_Menu.Link = drDim_Menu[Dict_Dim_Menu.Link].ToString();
            }
            if (drDim_Menu[Dict_Dim_Menu.Remark] != null && drDim_Menu[Dict_Dim_Menu.Remark].ToString() != "")
            {
                mDim_Menu.Remark = drDim_Menu[Dict_Dim_Menu.Remark].ToString();
            }
            if (drDim_Menu[Dict_Dim_Menu.Display] != null && drDim_Menu[Dict_Dim_Menu.Display].ToString() != "")
            {
                mDim_Menu.Display = Convert.ToInt32(drDim_Menu[Dict_Dim_Menu.Display].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.Sort] != null && drDim_Menu[Dict_Dim_Menu.Sort].ToString() != "")
            {
                mDim_Menu.Sort = Convert.ToInt32(drDim_Menu[Dict_Dim_Menu.Sort].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.Disabled] != null && drDim_Menu[Dict_Dim_Menu.Disabled].ToString() != "")
            {
                mDim_Menu.Disabled = Convert.ToInt32(drDim_Menu[Dict_Dim_Menu.Disabled].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.Rec_CreateTime] != null && drDim_Menu[Dict_Dim_Menu.Rec_CreateTime].ToString() != "")
            {
                mDim_Menu.Rec_CreateTime = Convert.ToDateTime(drDim_Menu[Dict_Dim_Menu.Rec_CreateTime].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.Rec_CreateBy] != null && drDim_Menu[Dict_Dim_Menu.Rec_CreateBy].ToString() != "")
            {
                mDim_Menu.Rec_CreateBy = drDim_Menu[Dict_Dim_Menu.Rec_CreateBy].ToString();
            }
            if (drDim_Menu[Dict_Dim_Menu.Rec_ModifyTime] != null && drDim_Menu[Dict_Dim_Menu.Rec_ModifyTime].ToString() != "")
            {
                mDim_Menu.Rec_ModifyTime = Convert.ToDateTime(drDim_Menu[Dict_Dim_Menu.Rec_ModifyTime].ToString());
            }
            if (drDim_Menu[Dict_Dim_Menu.Rec_ModifyBy] != null && drDim_Menu[Dict_Dim_Menu.Rec_ModifyBy].ToString() != "")
            {
                mDim_Menu.Rec_ModifyBy = drDim_Menu[Dict_Dim_Menu.Rec_ModifyBy].ToString();
            }
            return mDim_Menu;
        }

        #region IModel 成员

        public string TableName
        {
            get { return "Dim_Menu"; }
        }

        public string[] Columns
        {
            get { return new string[] { "MenuId", "MenuName", "ParentId", "Link", "Remark", "Display", "Sort", "Disabled", "Rec_CreateTime", "Rec_CreateBy", "Rec_ModifyTime", "Rec_ModifyBy" }; }
        }

        #endregion
    }
}
